<html>

	<head>
		<title>视频列表</title>
		<meta charset="utf-8">
		<meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
		<meta name="format-detection" content="telephone=no,email=no,date=no,address=no">

		<link href="../../css/skin/default/style.css" rel="stylesheet" type="text/css" />
		<link href="../../css/dialog.css" rel="stylesheet">
		<link href="../../js/lib/ligerUI/skins/Aqua/css/ligerui-all.css" rel="stylesheet" type="text/css" />

		<script src="../../js/lib/jquery/jquery-1.10.2.min.js" type="text/javascript"></script>
		<script src="../../js/lib/ligerUI/js/ligerui.all.js" type="text/javascript"></script>

		<script src="../../js/lib/ligerUI/js/plugins/ligerPopupEdit.js"></script>
		<script src="../../js/lib/ligerUI/js/plugins/ligerLayout.js" type="text/javascript"></script>
		<script src="../../js/lib/ligerUI/js/plugins/ligerGrid.js" type="text/javascript"></script>
		<script src="../../js/lib/ligerUI/js/plugins/ligerForm.js" type="text/javascript"></script>
		<script src="../../js/lib/ligerUI/js/plugins/ligerCheckBox.js" type="text/javascript"></script>
		<script src="../../js/lib/ligerUI/js/plugins/ligerComboBox.js" type="text/javascript"></script>
		<script src="../../js/lib/ligerUI/js/plugins/ligerDateEditor.js" type="text/javascript"></script>
		<script src="../../js/lib/ligerUI/js/plugins/ligerRadio.js" type="text/javascript"></script>
		<script src="../../js/lib/ligerUI/js/plugins/ligerTextBox.js" type="text/javascript"></script>
		<script src="../../js/lib/ligerUI/js/plugins/ligerSpinner.js" type="text/javascript"></script>
		<script src="../../js/lib/ligerUI/js/plugins/ligerTree.js" type="text/javascript"></script>
		<script src="../../js/lib/ligerUI/js/plugins/ligerDialog.js" type="text/javascript"></script>
		<script src="../../js/lib/ligerUI/js/plugins/ligerDrag.js" type="text/javascript"></script>
		<script src="../../js/lib/ligerUI/js/plugins/ligerResizable.js" type="text/javascript"></script>
		<script src="../../js/lib/ligerUI/js/plugins/ligerTip.js" type="text/javascript"></script>
		<script src="../../js/lib/ligerUI/js/plugins/ligerMenu.js" type="text/javascript"></script>
		<script src="../../js/lib/ligerUI/js/plugins/ligerToolBar.js" type="text/javascript"></script>
		<script src="../../js/lib/jquery.form.js" type="text/javascript"></script>
		<script src="../../js/lib/json2.js" type="text/javascript"></script>
		<script src="../../js/dialog.js"></script>
		<script src="../../js/JS/layout.js"></script>
		<script src="../../js/constants.js" type="text/javascript"></script>
		<script src="../../js/api.js" type="text/javascript"></script>
	
		<script type="text/javascript">
			var manager;
			$(document).hover(parent.hindMenu);

			var mid = $api.getparastr("mid");
			var phototypeUrl = BaseUrl + "AttachType2?token=" + $api.getStorage("token");

			$(function() {
				$("form").ligerForm();
				toolbar();
				initView();

			});

			function initView() {

				manager = $("#maingrid").ligerGrid({
					columns: [{
						display: '文件名',
						name: 'Fname',
						align: 'left',
						minWidth: 220
					},
					{
							display: '用户管理',
							isSort: true,
							name: 'handle',
							width: 240,
							align: 'center',
							render: function(item, rowindex, value) {
								return "<div class='listbtn' style='width:90px;margin-top:5px;'  onclick='detail(" + rowindex + ");'>相册图片管理</div> ";
							}
						}],
					dataAction: 'local',
					url: phototypeUrl,
					method:'get',
					width: '99.5%', 
					rowHeight: 40,
					height:'85%',
					onDblClickRow: function(data, rowindex, rowobj) {

						window.location.href = 'PhotoDetail.html?ftypeid=' + data.Fid;

					}
				});
			}
			
			function detail(i){
				var row = manager.getRow(i);
				window.location.href="PhotoDetail.html?ftypeid="+row.Fid;
			}

			function toolbar() {
				$api.getLimit(mid, 0, function(data) {
					$("#icon-list").append(data);
				});
			}

			function add() {
				parent.openCommWindow('vcommon/common/CreatePhotoDialog.html',
					"相册", 320, 300, 'phototype');
			}

			function edit() {
				var row = manager.getSelectedRow();
				if(row) {
					if(row.Fid==0){
						$.ligerDialog.warn("默认相册不能修改！");
						return;
					}
					parent.openCommWindow('vcommon/common/CreatePhotoDialog.html?data=' + escape(JSON.stringify(row)), "相册", 320, 300, 'phototype');
				} else {
					$.ligerDialog.warn("请选择行");
				}
			}

			function saveInfo(row, cmd) {
				if(cmd == 'phototype') {
					var attrTypeUrl = BaseUrl + "AttachType?token=" + $api.getStorage("token")

					if(row.Fid == 0) {
						url = attrTypeUrl + "&action=add";

					} else
						url = attrTypeUrl + "&action=edit";

					$api.ajaxapp2(url, row,  function(data) {
						f_reload();
					});
				}
			}

			function del() {
				var row = manager.getSelectedRow();
				if(row) {
					if(row.Fid==0){
						$.ligerDialog.warn("默认相册不能删除！");
						return;
					}
					$.ligerDialog.confirm("相册删除后将不能回复，\n您确定要移除？", function(yes) {
						if(yes) {
							var url = BaseUrl + "AttachType?token=" + $api.getStorage("token");

							url += "&action=del";

							$api.ajaxapp2(url, row, function(data) {
								f_reload();
							});
						}
					})
				} else {
					$.ligerDialog.warn("请选择行！");
				}
			}

			function f_reload() {
 
				manager.GetDataByURL(phototypeUrl);
			}
		</script>

	</head>

	<body class="mainbody">
		<form id="form1" onsubmit="return false">
			<div class="div-alarm">文件夹删除后图片文件将归入默认相册，默认相册为系统相册不允许修改/删除</div>
			<div class="toolbar-wrap">
				<div  class="toolbar">
					<div class="l-list">
						<ul id="icon-list" class="icon-list">
						</ul>
					</div>
				</div>
			</div>

			<div id="maingrid" style="margin: 0px;background:#fff;"></div>

		</form>

	</body>

</html>